<include file="public@head_top"/>
</head>
<body class="bgeee">
<include file="public@head"/>

<div class="wrap clearfloat checkout">

	<style>.bgeee{ background:#fff;}
	#top {box-shadow: none;border-bottom: 1px solid #ddd;}
	.checkout *,
	.checkout *::before,
	.checkout *::after {
	  box-sizing: border-box; }
	.checkout{ margin-top:150px; margin-bottom:30px;}
    @media only screen and (max-width: 991px) {
		.bgeee{ background:#eee;}
		.checkout{ margin-top:70px;}
		#footer{ padding-bottom: 62px;}
	}
    </style>
    <link rel="stylesheet" href="__TMPL__/public/assets/css/checkout2.css">
    <link rel="stylesheet" href="__TMPL__/public/assets/css/modal.css">
    <style>
        .quentity input{
            width: 40px;
            padding: 5px 10px;
            text-align: center;
			border: 1px solid #e9e9e9;
			background: rgb(235, 235, 228);
        }
    </style>

        <svg style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
            <defs>
                <symbol id="icon-add" viewBox="0 0 32 32">
                    <title>add2</title>
                    <path class="path1" d="M15 17h-13.664c-0.554 0-1.002-0.446-1.002-1 0-0.552 0.452-1 1.002-1h13.664v-13.664c0-0.554 0.446-1.002 1-1.002 0.552 0 1 0.452 1 1.002v13.664h13.664c0.554 0 1.002 0.446 1.002 1 0 0.552-0.452 1-1.002 1h-13.664v13.664c0 0.554-0.446 1.002-1 1.002-0.552 0-1-0.452-1-1.002v-13.664z"></path>
                </symbol>
                <symbol id="icon-ok" viewBox="0 0 39 32">
                    <title>ok</title>
                    <path class="path1" d="M14.084 20.656l-7.845-9.282c-1.288-1.482-3.534-1.639-5.016-0.351s-1.639 3.534-0.351 5.016l10.697 12.306c1.451 1.669 4.057 1.623 5.448-0.096l18.168-22.456c1.235-1.527 0.999-3.765-0.528-5.001s-3.765-0.999-5.001 0.528l-15.573 19.337z"></path>
                </symbol>
                <symbol id="icon-edit" viewBox="0 0 32 32">
                    <title>edit</title>
                    <path class="path1" d="M25.599 11.292l-4.892-4.892 3.825-3.825 4.892 4.892-3.825 3.825zM4.732 23.308l3.959 3.959-5.939 1.98 1.98-5.939zM10.666 26.225l-4.892-4.892 13.425-13.425 4.892 4.892-13.425 13.425zM31.687 6.713l-6.4-6.4c-0.417-0.417-1.091-0.417-1.508 0l-20.267 20.267c-0.114 0.115-0.191 0.25-0.242 0.393-0.003 0.009-0.012 0.015-0.015 0.025l-3.2 9.6c-0.128 0.383-0.029 0.806 0.257 1.091 0.203 0.204 0.476 0.313 0.754 0.313 0.112 0 0.227-0.017 0.337-0.054l9.6-3.2c0.011-0.003 0.017-0.013 0.027-0.016 0.142-0.052 0.276-0.128 0.39-0.242l20.267-20.267c0.417-0.416 0.417-1.091 0-1.508v0z"></path>
                </symbol>
                <symbol id="icon-del" viewBox="0 0 26 32">
                    <title>delete</title>
                    <path class="path1" d="M17.723 28c0.543 0 0.984-0.448 0.984-1v-12c0-0.552-0.441-1-0.984-1s-0.985 0.448-0.985 1v12c0 0.552 0.441 1 0.985 1v0zM7.877 28c0.543 0 0.984-0.448 0.984-1v-12c0-0.552-0.441-1-0.984-1s-0.985 0.448-0.985 1v12c0 0.552 0.441 1 0.985 1v0zM12.8 28c0.543 0 0.985-0.448 0.985-1v-12c0-0.552-0.441-1-0.985-1s-0.984 0.448-0.984 1v12c0 0.552 0.441 1 0.984 1v0zM23.631 4h-5.908v-2c0-1.104-0.882-2-1.969-2h-5.908c-1.087 0-1.969 0.896-1.969 2v2h-5.908c-1.087 0-1.969 0.896-1.969 2v2c0 1.104 0.882 2 1.969 2v18c0 2.208 1.765 4 3.939 4h13.784c2.174 0 3.938-1.792 3.938-4v-18c1.087 0 1.969-0.896 1.969-2v-2c0-1.104-0.882-2-1.969-2v0zM9.846 3c0-0.552 0.441-1 0.984-1h3.938c0.544 0 0.985 0.448 0.985 1v1h-5.908v-1zM21.662 28c0 1.104-0.882 2-1.969 2h-13.784c-1.087 0-1.97-0.896-1.97-2v-18h17.723v18zM22.646 8h-19.692c-0.543 0-0.985-0.448-0.985-1s0.441-1 0.985-1h19.692c0.543 0 0.984 0.448 0.984 1s-0.441 1-0.984 1v0z"></path>
                </symbol>
                <symbol id="icon-clock" viewBox="0 0 32 32">
                    <title>clock</title>
                    <path class="path1" d="M29.333 16c0-7.364-5.97-13.333-13.333-13.333s-13.333 5.97-13.333 13.333c0 7.364 5.97 13.333 13.333 13.333s13.333-5.97 13.333-13.333v0 0 0 0 0 0zM0 16c0-8.837 7.163-16 16-16s16 7.163 16 16c0 8.837-7.163 16-16 16s-16-7.163-16-16zM14.667 14.667v1.333h2.667v-10.667h-2.667v9.333zM24 18.667h1.333v-2.667h-10.667v2.667h9.333z"></path>
                </symbol>
            </defs>
        </svg>
		
	<style>
		.cart-item-shop{ display: table-header-group;}
		.cart-item-shop .item-price {color: #d1434a; }
		.cart-item-shop dl{ display: table-row; background: #f8f8f8;}
		.cart-item-shop dl dd{ display: table-cell; height: 45px; line-height: 45px; padding-left:15px; padding-right: 15px; border-bottom:1px solid #ddd;}
		.cart-item-shop dl dd.shop-tab-1{ border-left: 1px solid #e9e9e9;}
		.cart-item-shop dl dd.shop-tab-5{ border-right: 1px solid #e9e9e9;}
		@media only screen and (max-width: 991px) {
			.cart-item-shop {
				display: block;
			}
			.cart-item-shop dl{ display: block; background: #fff;}
			.cart-item-shop dl dd{ display: none;}
			.cart-item-shop dl dd.shop-tab-1{ display: block; border-left:none;}
			.cart-item-shop dl dd.shop-tab-5{ border-right:none;}
		}
	</style>
        <div class="cart">

            <!--商品信息-->
            <div class="item-list-wrap">
                <div class="cart-item">
                    <div class="cart-item-head">
                        <ul>
                            <li>商品信息</li>
                            <li>商品金额</li>
                            <li>商品数量</li>
                            <li>总金额</li>
                            <li>操作</li>
                        </ul>
                    </div>
                    
                    <!--商品列表信息-->
					<foreach name="cartshoplist" key="k" item="v">
                      <notempty name="configinfo['supplierok']">
					  <div class="cart-item-shop">
						  <dl>
							  <dd class="shop-tab-1">店铺名称：{$v.shop_name}</dd>
							  <dd class="shop-tab-2"></dd>
							  <dd class="shop-tab-3"></dd>
							  <dd class="shop-tab-4"></dd>
							  <dd class="shop-tab-5"></dd>
						  </dl>
					  </div>
                      </notempty>
                    <ul class="cart-item-list">
					  <foreach name="v.list" key="key" item="vo">
                      <li>
                        <div class="cart-tab-1">
                          <div class="cart-item-check">
						  	<input type="checkbox" class="check-item" value="{$vo.id}">
                          </div>
                          <div class="cart-item-pic">
                          	<a href="{:cmf_url('portal/Article/index',array('id'=>$vo['listid'],'cid'=>$vo['listcatid']))}" target="_blank" title="{$vo.goods_name}"><img class="goods-image" src="/upload/{$vo.goods_img}" widt="100" height="100" /></a>
                          </div>
                          <div class="cart-item-title">
                            <div class="item-name">
                              <a href="{:cmf_url('portal/Article/index',array('id'=>$vo['listid'],'cid'=>$vo['listcatid']))}" target="_blank" title="{$vo.goods_name}">{$vo.goods_name}</a>
                            </div>
							<p class="st-x-showmobile">价格：<font class="item-price">￥{$vo.price}</font></p>
                          </div>
                          <div class="item-include">
                            <dl>
                              <dd>
                              <foreach name="vo.goods_attr_arr" key="ks" item="vs">
                              {$ks}：{$vs} | 
                              </foreach>
                              </dd>
                            </dl>
                          </div>
                        </div>
                        <div class="cart-tab-2">
                          <div class="item-price">￥<span id="price_{$vo.id}">{$vo.price}</span></div>
                        </div>
                        <div class="cart-tab-3">
                          <div class="item-quantity">
                            <div class="select-self select-self-open">
                              <div class="quentity">
                                <if condition="$vo.integralgoods eq 1">
                                <input id='num_{$vo.id}' type="text" value="{$vo.number}" disabled="disabled">
                                <else>
                              	<a href="javascript:;" onClick="metapp_shop_setamount({$vo.id},'reduce')"> - </a>
                                <input id='num_{$vo.id}' type="text" value="{$vo.number}" onChange="metapp_shop_setamount({$vo.id},'set')">
                                <a href="javascript:; " onClick="metapp_shop_setamount({$vo.id},'add')"> + </a>
                                </if>
                              </div>
                            </div>
                            <div class="item-stock"> 有货 </div>
                          </div>
                        </div>
                        <div class="cart-tab-4">
                          <div class="item-price-total">￥<span class="span_xiaoji" id="span_xiaoji_{$vo.id}"><php>echo round($vo['price'] * $vo['number'], 2);</php></span></div>
                        </div>
                        <div class="cart-tab-5">
                          <div class="cart-item-opration"><a href="javascript:;" class="item-edit-btn" onClick="delcartgoods({$vo.id});"><svg class="icon icon-del">
                            <use xlink:href="#icon-del"></use>
                            </svg></a></div>
                        </div>
                      </li>
				      </foreach>
                    </ul>
					</foreach>
                    <div style="clear:both"></div>

                </div>
            </div>

			<!--footer-->
            <div class="cart-foot-wrap">
              <div class="cart-foot-l">
                <div class="item-all-check">
                    <label style="cursor:pointer;">
                        <input type="checkbox" id="checked-all-bottom" />
                        <span style="vertical-align:top;">全选</span>
                    </label>
                </div>
                <div class="item-all-del"><a href="javascript:;" onClick="delcartgoods(0,1);">批量删除</a></div>
              </div>
              <div class="cart-foot-r">
                <div class="item-total">总价：<span class="total-price">￥<span id="total">0.00</span> 元</span></div>
                <div class="next-btn-wrap"><a href="/list108-cn.html?act=done" class="st-btn st-btn-red"> 结账 </a></div>
              </div>
            </div>
            
        </div>

        <!--模态框-->
        <div id="showModal" class="md-modal modal-msg md-modal-transtion">
          <div class="md-modal-inner">
            <div class="md-top">
              <button class="md-close tipColseBox"> 关闭 </button>
            </div>
            <div class="md-content">
              <div class="confirm-tips">
                <p id="cusLanInfo">你确认删除此订单信息吗?</p>
              </div>
              <div class="btn-wrap">
                <button id="btnModalConfirm" class="st-btn st-btn-m"> YES</button>
                <button id="btnModalCancel" class="st-btn st-btn-m st-btn-red tipColseBox"> NO</button>
              </div>
            </div>
          </div>
        </div>
        <!--遮罩层-->
        <div id="showOverLay" class="md-overlay" style="display:none;"></div>

</div>

<script>
function metapp_shop_setamount(id,type){
	if(type == "add"){
		var number = Number($("#num_"+id).val()) + Number(1);
		$("#num_"+id).val(number);
		totalprice(id);
	}else if(type == "reduce"){
		if($("#num_"+id).val() > 1){
			 var number = Number($("#num_"+id).val()) - Number(1);
			 $("#num_"+id).val(number);
			 totalprice(id);
		 }	
	}else{
		// 判断修改数量是否是数字和数量大于0时
		if($("#num_"+id).val() < 1 || !$.isNumeric($("#num_"+id).val())){
			$("#num_"+id).val(1);	
		}  
		totalprice(id);
	}
	setTotal();
	var tnumber = $("#num_"+id).val();
	$.post("/portal/Ajax/index.html",{ajaxmember:"ok",ajaxid:id,ajaxname:"cartnumber",number:tnumber},function(data){
			var data=eval('('+data+')');
			console.log(data);
			var content = data.content;
			$("#cartnumber").html(content.cartnumber);
	  });
}
  function totalprice(id){
	var number = $("#num_"+id).val();	
	var price = $("#price_"+id).html();
	var totalprice = Number(number) * Number(price);
	$("#span_xiaoji_"+id).html(totalprice.toFixed(2));
  }
  function setTotal(){ 
	var s=0; 
	$(".span_xiaoji").each(function(){ 
	s+=Number($(this).html()); 
	}); 
	$("#total").html(s.toFixed(2)); 
	} 
	setTotal();
	function delcartgoods(id,checkall){
		$("#showModal").addClass("md-show");
		$("#showOverLay").show();
		$("#btnModalConfirm").click(function(){
				var goodsids = '';
				if(checkall){
					 $(".goods-list-item:checked").each(function(){
						goodsids += $(this).val() + ",";
					  });
					  goodsids = goodsids.substr(0, goodsids.length - 1);
					  if(!goodsids) {
					  	Wind.use("noty", function () {
							noty({
								text: "请先选择一个商品！",
								type: "error",
								layout: "center"
							});
						});
						return;
					  }
				}
				$.post("/portal/Ajax/index.html",{ajaxmember:"ok",ajaxid:id,ajaxname:"delcart",ids:goodsids},function(data){
					var data=eval('('+data+')');
					console.log(data);
					if(data.error == 0){
						location.reload();	
						var content = data.content;
						$("#cartnumber").html(content.cartnumber);
					}
					
				});	
		});
		$(".tipColseBox").click(function(){
			$("#showModal").removeClass("md-show");
			$("#showOverLay").hide();
		});
	} 
// 全选
function checkedAll(_this) {
	for(var i = 0; i < $('.cart-item-list li').length; i++) {
		var elInput = $('.cart-item-list li').eq(i).find('.check-item')
		var isChecked = $('.cart-item-list li').eq(i).find('.check-item')[0].checked
		if(_this.checked) {
			if(!isChecked) {
				elInput.prop('checked', true)
			}
		} else {
			if(isChecked) {
				elInput.prop('checked', false)
			}
		}
	}
}
$('#checked-all-bottom').on('change', function() {
	checkedAll(this)
})
</script>

</div>
                    
<include file="public@footer"/>
</body>    
</html>